package com.yuanqiao.interfaceforlc.uploadmatterandfile.service;

import com.yuanqiao.interfaceforlc.uploadmatterandfile.dao.uploadDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class uploadService {
    @Autowired
    private uploadDao uploaddao;
    public String getfileString(String serialNo, String docId, String fileId) {
        return uploaddao.getfileString(serialNo,docId,fileId);
    }

    public int savemandf(String uploadtype, String serialNo, String docId, String docNo, String fileId, String fileNo,String url,String time) {
        String id=UUID.randomUUID().toString().replace("-","").toUpperCase();
        if("m".equals(uploadtype)){
            return uploaddao.savem(uploadtype,serialNo,docId,docNo,fileId,fileNo,url,time,id);
        }else if ("f".equals(uploadtype)){
            return uploaddao.savef(uploadtype,serialNo,docId,docNo,fileId,fileNo,url,time,id);
        }else{
            return 0;
        }

    }

    public void deletesamefileIddile(String serialNo, String docId, String fileId) {
        uploaddao.deletesamefileIddile(serialNo,docId,fileId);
    }

    public int deletefile(String id) {
        return uploaddao.deletefile(id);
    }

    public String geturlbyfileid(String id) {
        return uploaddao.geturlbyfileid(id);
    }

    public List queryAllfile(String serialNo) {
        return uploaddao.queryAllfile(serialNo);
    }

    public int insertmargePDF(String fileId, String url) {
        String id=UUID.randomUUID().toString().replace("-","").toUpperCase();
        return uploaddao.insertmargePDF(fileId,url,id);
    }

    public String chooseshenqingshu(String bigEntType) {
         return uploaddao.chooseshenqingshu(bigEntType);
    }
}
